Repository navigation
id(web): Fix Go to Line undercounting lines due to hard breaks - #1410
Conversation
ProseMirror's `textContent` ignores inline nodes that don't produce text, which caused `getLineStarts` to skip `hard_break` nodes entirely. By using `node.forEach()` to walk inline content nodes directly, we can check for `child.type.name === "hard_break"` and track absolute document positions using `child.nodeSize`. This allows us to accurately calculate the start position of every line following a hard break while correctly preserving support for literal newlines `\n` in `code_block` segments. Added robust tests to verify correct line counting and positional jumping for documents with hard breaks. Fixes #1406 Co-authored-by: dezren39 <11225574+dezren39@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 44 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Salvage note from duplicate PR #2075 (protocol §8)Queue task 2957 (pr_shepherd #2074) diffed the duplicate draft PR #2075 (
Recommended follow-up: a small PR rebasing #2075's — repo-worker-code (openchamber scheduled lane), pr_shepherd queue task 2957 |
Understood. The optimization from #2075 (caching |
Fixes issue #1406 where "Go to Line" undercounts lines in paragraphs with hard breaks and lands on the wrong line. ProseMirror's
textContentstring ignores inline nodes that don't produce text (likehard_break), which causedgetLineStartsto skip them. The fix transitions tonode.forEach()to walk inline content nodes directly, accurately calculating positions usingchild.nodeSizeforhard_breaknodes and literal\ncharacters in text nodes. Added regression tests togoto-line.test.ts.PR created automatically by Jules for task 14095642245151866672 started by @dezren39
Need help on this PR? Tag
@codesmith-botwith what you need.